package at.ac.tuwien.lsds.util;

import org.apache.log4j.Logger;

import at.ac.tuwien.lsds.model.ScenarioEnum;
import at.ac.tuwien.lsds.model.ScheduleStrategyEnum;

public class Settings {
	
	private static final Logger log = Logger.getLogger(Settings.class);
	
	private static String separator;
	private static Integer generatorNumberOfApps;
	private static String generatorDirectory;
	private static String inputFilePath;
	private static String schedulerOutputDirectory;
	private static String processSummaryOutputFilePath;
	private static Integer pmCount;
	private static Integer cloudPartnerCount;
	private static ScenarioEnum scenario;
	private static ScheduleStrategyEnum scheduler;
	private static String decimalFormat;
	
	public static void resetToDefault() {
		log.debug("---------- RESET SETTINGS TO DEFAULT ----------");
		setSeparator(";");
		setGeneratorDirectory("resources/input");
		setGeneratorNumberOfApps(500);
		setInputFilePath("resources/input/inputDataA.csv");
		setSchedulerOutputDirectory("resources/output");
		setPmCount(4);
		setCloudPartnerCount(2);
		setScenario(ScenarioEnum.A);
		setScheduler(ScheduleStrategyEnum.A);
		setDecimalFormat("###.##");
	}
	
	
	public static String getInputFilePath() {
		return inputFilePath;
	}
	public static void setInputFilePath(String inputFilePath) {
		Settings.inputFilePath = inputFilePath;
	}
	
	public static String getSchedulerOutputDirectory() {
		return schedulerOutputDirectory;
	}
	public static void setSchedulerOutputDirectory(
			String schedulerOutputDirectory) {
		Settings.schedulerOutputDirectory = schedulerOutputDirectory;
	}

	public static Integer getPmCount() {
		return pmCount;
	}
	public static void setPmCount(Integer pmCount) {
		Settings.pmCount = pmCount;
	}
	
	public static Integer getCloudPartnerCount() {
		return cloudPartnerCount;
	}
	public static void setCloudPartnerCount(Integer cloudPartnerCount) {
		Settings.cloudPartnerCount = cloudPartnerCount;
	}
	
	public static ScenarioEnum getScenario() {
		return scenario;
	}
	
	public static void setScenario(ScenarioEnum scenario) {
		Settings.scenario = scenario;
	}

	public static String getSeparator() {
		return separator;
	}
	public static void setSeparator(String separator) {
		Settings.separator = separator;
	}

	public static String getProcessSummaryOutputFilePath() {
		return getSchedulerOutputDirectory() + "/processSummary.csv";
	}

	public static ScheduleStrategyEnum getScheduler() {
		return scheduler;
	}


	public static void setScheduler(ScheduleStrategyEnum scheduler) {
		Settings.scheduler = scheduler;
	}


	public static String getSettingsDescription() {
		String ret = "";
		ret += "\nCurrent Settings:\n";
		ret += "GeneratorDirectory:" + getGeneratorDirectory() + "\n";
		ret += "GeneratorNumberOfApps:" + getGeneratorNumberOfApps() + "\n";
		ret += "InputFilePath:" + getInputFilePath() + "\n";
		ret += "Separator: '" + getSeparator() + "'\n";
		ret += "PMs: " + getPmCount() + "\n";
		ret += "CloudPartner: " + getCloudPartnerCount() + "\n";
		ret += "Scenario:" + getScenario() + "\n";
		ret += "Scheduler:" + getScheduler() + "\n";
		ret += "OutputPath:" + getSchedulerOutputDirectory() + "\n";
		return ret;
	}


	public static String getDecimalFormat() {
		return decimalFormat;
	}


	public static void setDecimalFormat(String decimalFormat) {
		Settings.decimalFormat = decimalFormat;
	}


	public static String getGeneratorDirectory() {
		return generatorDirectory;
	}


	public static void setGeneratorDirectory(String generatorDirectory) {
		Settings.generatorDirectory = generatorDirectory;
	}


	public static Integer getGeneratorNumberOfApps() {
		return generatorNumberOfApps;
	}


	public static void setGeneratorNumberOfApps(Integer generatorNumberOfApps) {
		Settings.generatorNumberOfApps = generatorNumberOfApps;
	}
	
}
